﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace DailyRssDownload.Lib {
	[Serializable]
	public class AtomFeed : Feed {
		private XNamespace _atomNamespace = "http://www.w3.org/2005/Atom";

		public AtomFeed() {
		}

		public AtomFeed(XDocument rssfeed) {
			this.Title = rssfeed.Root.Element(_atomNamespace + "title").Value;
		}

		public override IEnumerable<Entry> GetEntries(XDocument rssfeed) {
			return from item in rssfeed.Descendants(_atomNamespace + "entry")
				   select (Entry)new AtomEntry(item, this);
		}
	}
}
